package main

import "fmt"

//interface{}是万能数据类型
func myFunc(arg interface{}){
    fmt.Println(arg)

    // 给interface{} 提供 "类型断言" 机制
    value,ok := arg.(string)
    if ok {
        fmt.Println("arg is string type, value = ",value)
        fmt.Printf("value type is %T\n",value)
    }else{
        fmt.Println("arg is not string type")
    }
}

type Book struct{
    author string
}

func main(){
    book := Book{"JackyChen"}
    myFunc(book)
    fmt.Println("=========")
    myFunc(100)
    fmt.Println("=========")
    myFunc("abc")
}